package controllers;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import models.model.Users;
import models.service.UsersService;
import models.vo.query.UsersQuery;

@Controller
@RequestMapping("/user")
public class UsersController {

	@Autowired
	private UsersService usersService;
	
	@ResponseBody
	@RequestMapping("/login")
	public String login(ModelMap mo,String name,String pwd) {
		
		
		UsersQuery uq = new UsersQuery();
		uq.setName(name);
		uq.setPwd(pwd);
		List<Users> result = usersService.findPage(uq).getResult();
		
		if(result.size()>0) {
			
			return "ok";
		}else {
			return "on";
			
		}
		
		
	}
}
